package main

import (
	maker2 "api/libs/maker"
	"gitee.com/dreamwood/ez-maker/maker"
)

func main() {
	maker2.Prepare()
	Report()
	ReportType()
	ReportStatus()
}

func Report() {
	c := maker.CreateTable("Report", "日常汇报", "oa")
	c.AddText("userName", "发布人")
	c.AddInt("userId", "发布人ID")
	c.AddArt("content", "内容")

	c.AddManyToOne("type", "汇报类型", "ReportType")

	c.AddDateTime("startAt", "记录日期")
	c.AddDateTime("endAt", "完成日期")
	c.AddText("state", "完成情况")
	c.AddManyToOne("status", "状态", "ReportStatus")
	c.AddBool("isPlan", "是否是计划")

	c.AddBool("isNumbered", "是否量化")
	c.AddFloat("target", "目标").SetDesc("默认100，结合percent使用，设置量化数据，用于以后扩展量化考核")
	c.AddFloat("done", "完成度").SetDesc("默认0设置量化数据，用于以后扩展量化考核")
	c.AddFloat("score", "得分").SetDesc("默认done/target设置量化数据，用于以后扩展量化考核")

	c.AddCreateAt()
	c.AddUpdateAt()
	c.Generate()
}

func ReportType() {
	c := maker.CreateTable("ReportType", "汇报类型", "oa")
	c.AddName()
	c.LoadTree()
	c.AddText("mustKey", "KEY")
	c.Generate()

}

func ReportStatus() {
	c := maker.CreateTable("ReportStatus", "汇报状态", "oa")
	c.AddName()
	c.LoadStatus()
	c.AddText("mustKey", "KEY")
	c.Generate()

}
